package org.dendy.app.texteditor;

import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;

public class OpenShell {

	Shell shell = null;

	Item itemClass = null;

	/**
	 * Membuat tampilan display
	 * 
	 * @param display
	 */
	void createShell(Display display) {
		Image image = new Image(display, "image/Text.png");
		shell = new Shell(display);
		shell.setText("SWT Editor");
		shell.setImage(image);
		shell.setLayout(new GridLayout());
	}

	/**
	 * fungsi membuat tampilan dengan memanggil semua method yang ada di class
	 * 
	 * @return shell
	 */
	public Shell open(Display display) {
		createShell(display);
		// Membuat objek untuk memanggil fungsi yang ada di class item
		itemClass = new Item(shell);
		itemClass.createMenuBar();
		itemClass.createToolBar(display);
		itemClass.createStyledText(display);
		shell.open();
		shell.setSize(600, 500);
		return shell;
	}

}
